package com.kamistoat.meimeichatserveraggrement.protocol.p2p;

import com.kamistoat.meimeichatserveraggrement.protocol.Command;
import com.kamistoat.meimeichatserveraggrement.protocol.Packet;

/**
 * 当ClientA试图和ClientB建立UDP打洞时，服务器携带A的UDP地址发送该请求给B。
 * 该请求可用UDP也可用TCP。使用TCP是因为这里是建立UDP打洞的最后一个保证可靠传输的地方
 */
public class TCP_EstablishP2PServer2Client extends Packet {
    private String targetUserId;
    private String targetUserHost;
    private Integer targetUserPort;

    public TCP_EstablishP2PServer2Client() {
    }

    public TCP_EstablishP2PServer2Client(String targetUserId, String targetUserHost, Integer targetUserPort) {
        this.targetUserId = targetUserId;
        this.targetUserHost = targetUserHost;
        this.targetUserPort = targetUserPort;
    }

    public String getTargetUserId() {
        return targetUserId;
    }

    public void setTargetUserId(String targetUserId) {
        this.targetUserId = targetUserId;
    }

    public String getTargetUserHost() {
        return targetUserHost;
    }

    public void setTargetUserHost(String targetUserHost) {
        this.targetUserHost = targetUserHost;
    }

    public Integer getTargetUserPort() {
        return targetUserPort;
    }

    public void setTargetUserPort(Integer targetUserPort) {
        this.targetUserPort = targetUserPort;
    }

    /**
     * 获取协议指令
     *
     * @return 返回指令值
     */
    @Override
    public Byte getCommand() {
        return Command.TCP_EstablishP2PServer2Client;
    }
}
